<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>{$title}</title>
    <link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layui/2.6.8/css/layui.css">
    <link rel="stylesheet" href="__STATIC__/css/admin_style.css?v=1024">
    <script type="text/javascript" src="__STATIC__/js/jquery.js?v=1024"></script>
    <script type="text/javascript" src="__STATIC__/js/jquery.clipboard.js?v=1024"></script>
    <script type="text/javascript" src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layui/2.6.8/layui.js"></script>
    <script>
        var ROOT_PATH="__ROOT__",ADMIN_PATH="{$_SERVER['SCRIPT_NAME']}", MAC_VERSION='v10';
    </script>
</head>
<body>
<style>
@media screen and (max-width:768px){
	.layui-content,.layui-contentAD {white-space:nowrap;overflow:scroll;position:relative;width:100%;}
	.layui-contentAD td{float: left;width: 100%;}
}
</style>
<div class="p10">
    <div class="showpic" style="display:none;">
        <img class="showpic_img" style="width:100%;height:100%;" referrerPolicy="no-referrer"></div>
    <form class="layui-form layui-form-pane" name="configform" id="configform">
        <div class="layui-tab" lay-filter="dmku" overflow>
            <ul class="layui-tab-title">
                <li class="layui-this">基本设置</li>
                <li class="">广告设置</li>
				<li class="">使用教程</li>
				</ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show" name="基本设置">
                    <blockquote class="layui-elem-quote layui-quote-nm">
                        <p>温馨提示：</p>
                        <p>本播放器基于Ckplayerx3播放器开发，官网：https://www.ckplayer.com/，此款播放器只适合在网页端使用，不支持在APP里面使用</p>
                        <p style="color:red;">一些功能在移动端不会生效，因为部分移动端浏览器会劫持播放器，替换为浏览器自带的播放器。</p>
                    </blockquote>
                    <fieldset class="layui-elem-field">
                        <legend>基本设置</legend>
                        <div class="layui-field-box">
							<div class="layui-form-item">
                                <label class="layui-form-label">自动播放</label>
                                <div class="layui-input-inline">
                                    <input type="checkbox" name="yzm[autoplay]" lay-skin="switch"  lay-filter="switchTest" lay-text="开|关" {if condition="$yzm.autoplay eq 'on'" }checked{/if}></div>
                                <div class="layui-form-mid layui-word-aux">开启后播放器加载完毕自动播放，关闭后需要手动点击播放，有部分浏览器自身原因会不支持</div></div>
							<div class="layui-form-item">
                                <label class="layui-form-label">记忆播放</label>
                                <div class="layui-input-inline">
                                    <input type="checkbox" name="yzm[history]" lay-skin="switch" lay-text="开|关" {if condition="$yzm.history eq 'on'" }checked{/if}></div>
                                <div class="layui-form-mid layui-word-aux">记录播放位置</div></div>
								
							<div class="layui-form-item">
                                <label class="layui-form-label">播放器右键</label>
                                <div class="layui-input-inline">
                                    <input type="checkbox" name="yzm[menu]" lay-skin="switch" lay-text="开|关" {if condition="$yzm.menu eq 'on'" }checked{/if}></div>
                                <div class="layui-form-mid layui-word-aux">是否开启播放器右键功能</div></div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">右键内容</label>
                                <div class="layui-input-inline w300">
                                    <textarea name="yzm[contextmenu]" class="layui-textarea" placeholder="弹幕播放器,https://www.baidu.com">{$yzm.contextmenu}</textarea></div>
                                <div class="layui-form-mid layui-word-aux">自定义播放器右键,说明：前面写名称，用英文逗号分隔，后面填写网址，需加http开头；多个换行填写
                                    <br>例子：弹幕播放器,https://www.baidu.com</div></div>
									
							<div class="layui-form-item">
                                <label class="layui-form-label">播放器语言</label>
                                <div class="layui-input-inline">
                                    <select name="yzm[language]">
										<option value="cn" {if condition="$yzm.language eq 'cn' or $yzm.language eq ''"}selected {/if}>中文</option>
										<option value="en" {if condition="$yzm.language eq 'en'"}selected {/if}>英文</option>
										<option value="zh.hk" {if condition="$yzm.language eq 'zh.hk'"}selected {/if}>繁体</option>
									</select>
								</div>
								<div class="layui-form-mid layui-word-aux">播放器语言</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">播放器风格</label>
                                <div class="layui-input-inline">
                                    <select name="yzm[style]">
										<option value="default" {if condition="$yzm.style eq 'default' or $yzm.style eq ''"}selected {/if}>默认</option>
										<option value="red" {if condition="$yzm.style eq 'red'"}selected {/if}>纯红</option>
										<option value="ixigua" {if condition="$yzm.style eq 'ixigua'"}selected {/if}>西瓜红</option>
									</select>
								</div>
								<div class="layui-form-mid layui-word-aux">播放器主题颜色</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">视频封面</label>
                                <div class="layui-input-inline long">
                                    <input type="text" name="yzm[pic]" value="{$yzm.pic}" class="layui-input upload-input  upload-img" placeholder="图片地址"></div>
									<div class="layui-form-mid layui-word-aux">视频加载时的预览图片，可以不设置，需为http开头的图片地址</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">LOGO</label>
                                <div class="layui-input-inline long">
                                    <input type="text" name="yzm[logo]" value="{$yzm.logo}" class="layui-input upload-input upload-img" placeholder="图片地址"></div>
                                <div class="layui-form-mid layui-word-aux">播放器logo图片地址</div>
                            </div>

                        </div>
                    </fieldset>
                   
                    <div class="layui-form-item">
                        <div class="center">
                            <button class="layui-btn" type="button" lay-submit="" lay-filter="save">立 即 保 存</button></div>
                    </div>
                </div>
                <div class="layui-tab-item" name="广告设置">
					<div class="layui-form-item">
                        <label class="layui-form-label">免广告权限</label>
                            <div class="layui-input-inline">
                                <select name="yzm[ads][group]">
									<option value="" >请选择</option>
									{volist name="group" id="vo"}
										{if condition="$vo['group_id']>1"}
										<option value="{$vo.group_id}" {if condition="$yzm.ads.group eq $vo['group_id']"}selected {/if}>{$vo.group_name}</option>
										{/if}
									{/volist}
								</select>
                        </div>
                        <div class="layui-form-mid layui-word-aux">选择哪个等级的会员可以免看广告</div></div>
						
					<fieldset class="layui-elem-field">
                        <legend>前置广告设置</legend>
					<div class="layui-field-box">						
						
						
                    <div class="layui-form-item">
                        <label class="layui-form-label">前置广告开关</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="yzm[ads][pre][state]" lay-skin="switch" lay-text="开|关" {if condition="$yzm.ads.pre.state eq 'on'" }checked{/if}>
                        </div>
						<div class="layui-form-mid layui-word-aux">只支持PC端显示前置广告，移动端有部分浏览器支持，大部分不支持显示。</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">前置广告类型</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="yzm[ads][pre][type]" lay-filter="adsType" value="1" title="视频" {if condition="$yzm.ads.pre.type neq '2'" }checked{/if}>
                            <input type="radio" name="yzm[ads][pre][type]" lay-filter="adsType" value="2" title="图片" {if condition="$yzm.ads.pre.type eq '2'" }checked{/if}></div>
							
                    </div>
					<div class="layui-form-item">
                        <label class="layui-form-label">广告关闭时间</label>
                        <div class="layui-input-inline">
                            <input type="number" name="yzm[ads][pre][closeTime]" value="{$yzm.ads.pre.closeTime}" class="layui-input" placeholder="多少秒后显示可关闭广告" ></div>
						<div class="layui-form-mid layui-word-aux">播放前置广告时多少秒后显示可关闭广告</div>	
                    </div>
					
                    <div id="adsvod" {if condition="$yzm.ads.pre.type eq '2'" }style="display:none;" {/if}>
                        <div class="layui-form-item">
                            <label class="layui-form-label">视频广告内容</label>
                            <div class="layui-input-inline long">
                                <input type="text" name="yzm[ads][pre][vod_url]" value="{$yzm.ads.pre.vod_url}" class="layui-input upload-input" placeholder="请输入视频地址"></div>
                            <div class="layui-form-mid layui-word-aux">广告视频直链地址</div></div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">视频广告链接</label>
                            <div class="layui-input-inline long">
                                <input type="text" name="yzm[ads][pre][vod_link]" value="{$yzm.ads.pre.vod_link}"  class="layui-input upload-input" placeholder="点击链接地址"></div>
                            <div class="layui-form-mid layui-word-aux">点击视频跳转链接地址</div></div>
                    </div>
                    <div id="adspic" {if condition="$yzm.ads.pre.type neq '2'" }style="display:none;" {/if}>
					<button class="layui-btn layui-btn-sm pre-add" type="button" >添加一组前置广告</button>
					
					<div id="pre_list" class="ads-content">
					{volist name="yzm.ads.pre.list" id="vo"}
						<div class="layui-form-item" data-i="{$key}"><label class="layui-form-label">前置广告{$key}：</label><input type="hidden" name="yzm[ads][pre][list][{$key}][type]" value="{$vo.type|default='picture'}"><div class="layui-input-inline"><input type="text" name="yzm[ads][pre][list][{$key}][file]" value="{$vo.file}" class="layui-input upload-img" placeholder="图片链接" ></div><div class="layui-input-inline"><input type="text" name="yzm[ads][pre][list][{$key}][link]" value="{$vo.link}" class="layui-input" placeholder="跳转链接" ></div><div class="layui-input-inline"><input type="number" name="yzm[ads][pre][list][{$key}][time]" value="{$vo.time}" class="layui-input" placeholder="显示时间(秒)" ></div><div class="layui-input-inline w400 p10"><a href="javascript:void(0)" class="pause-remove">删除{$key}</a></div></div>
					{/volist}
					</div>

						
                    </div>
					</div></fieldset>
					
					<fieldset class="layui-elem-field">
                        <legend>暂停广告设置</legend>
					<div class="layui-field-box">
					
                    <div class="layui-form-item">
                        <label class="layui-form-label">暂停广告开关</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="yzm[ads][pause][state]" lay-skin="switch"  lay-text="开|关" {if condition="$yzm.ads.pause.state eq 'on'" }checked{/if}>
                        </div>
                        <button class="layui-btn layui-btn-sm pause-add" type="button" >添加一组暂停广告数据</button>
					</div>
					
					<div id="pause_list" class="ads-content">
					{volist name="yzm.ads.pause.list" id="vo"}
						<div class="layui-form-item" data-i="{$key}"><label class="layui-form-label">暂停广告{$key}：</label><div class="layui-input-inline"><input type="text" name="yzm[ads][pause][list][{$key}][file]" value="{$vo.file}" class="layui-input upload-img" placeholder="图片链接" ></div><div class="layui-input-inline"><input type="text" name="yzm[ads][pause][list][{$key}][link]" value="{$vo.link}" class="layui-input" placeholder="跳转链接" ></div><div class="layui-input-inline"><input type="number" name="yzm[ads][pause][list][{$key}][time]" value="{$vo.time}" class="layui-input" placeholder="轮询显示时间(秒)" ></div><div class="layui-input-inline w400 p10"><a href="javascript:void(0)" class="pause-remove">删除{$key}</a></div></div>
					{/volist}
					</div>	
					</div></fieldset>
					
                    <div class="layui-form-item center">
                        <div>
                            <button class="layui-btn" type="button" lay-submit="" lay-filter="save">立 即 保 存</button></div>
                    </div>
                </div>
                <div class="layui-tab-item" name="调用教程">
                    <blockquote class="layui-elem-quote layui-quote-nm">
						<p>以下是手动调用此款播放器的教程：</p>
						<p>第一步，导航栏上找到“视频”-“播放器”</p>
						<p>第二步，选择指定的播放器，点击“编辑”</p>
						<p>第三步，在弹出的窗口中，选择切换到“播放器代码”</p>
						<p>第四步，复制下方的调用代码，粘贴到“播放器代码”中保存即可</p>
						<p>第五步，一定要清理清理浏览器缓存，否则可能前端不能实时显示</p>
					</blockquote>
					<div class="layui-form-item">
						<label class="layui-form-label">调用代码</label>
						<div class="layui-input-block">
							<textarea class="layui-textarea">MacPlayer.Html='<iframe width="100%" height="'+MacPlayer.Height+'" src="/static/player/cj/ckplayerx-ads.html" frameborder="0" allowfullscreen="true" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';MacPlayer.Show();</textarea>
						</div>    
					</div>
                </div>

            </div>
        </div>
    </form>
</div>

   

    
 


{include file="../../../application/admin/view/public/foot" /}

<script type="text/javascript">
install_dir = "{$GLOBALS['config']['site']['install_dir']}";
pause_ads_len = "{php}echo count($yzm['ads']['pause']['list']){/php}";
pre_ads_len = "{php}echo count($yzm['ads']['pre']['list']){/php}";
layui.use(['form', 'laydate', 'laypage', 'table', 'layer', 'element', 'colorpicker'], function() {
	var laydate = layui.laydate,
		laypage = layui.laypage,
		layer = layui.layer,
		table = layui.table,
		element = layui.element,
		form = layui.form,
		laytpl = layui.laytpl,
		colorpicker = layui.colorpicker;
	var api = install_dir + 'static/player/cj/dplayer/';
	element.on('tab(dmku)', function(data) {
		if (data.index == 2) {
			dmlist()
		} else if (data.index == 3) {
			report()
		}
	});
	
	form.on('radio(adsType)', function(data) {
		if (data.value == 1) {
			$("#adsvod").show();
			$("#adspic").hide()
		} else {
			$("#adspic").show();
			$("#adsvod").hide()
		}
	});
	form.on('submit(save)', function(data) {
		layer.msg('正在提交', {
			time: 30000,
			shade: 0.6,
			icon: 16
		});
		$.ajax({
			type: 'POST',
			data: data.field,
			dataType: 'json',
			url: './ckplayerx3',
			success: function(data) {
				layer.msg('保存完成', {
					time: 1000,
					icon: 1
				})
			}
		});
		return false
	});
	$('.pause-add').on('click',function(){
        pause_ads_len++;
        var tpl='<div class="layui-form-item" data-i="'+pause_ads_len+'"><label class="layui-form-label">暂停广告'+(pause_ads_len)+'：</label><div class="layui-input-inline"><input type="text" name="yzm[ads][pause][list]['+pause_ads_len+'][file]" class="layui-input" placeholder="图片链接" ></div><div class="layui-input-inline"><input type="text" name="yzm[ads][pause][list]['+pause_ads_len+'][link]" class="layui-input" placeholder="跳转链接" ></div><div class="layui-input-inline"><input type="number" name="yzm[ads][pause][list]['+pause_ads_len+'][time]" class="layui-input" placeholder="轮询显示时间(秒)" ></div><div class="layui-input-inline w400 p10"><a href="javascript:void(0)" class="pause-remove">删除'+pause_ads_len+'</a></div></div>';
        $("#pause_list").append(tpl);
    });
	if(pause_ads_len==0) {
        $('.pause-add').click();
    }
	$('.pre-add').on('click',function(){
        pre_ads_len++;
        var tpl='<div class="layui-form-item" data-i="'+pre_ads_len+'"><label class="layui-form-label">前置广告'+(pre_ads_len)+'：</label><input type="hidden" name="yzm[ads][pre][list]['+pre_ads_len+'][type]" value="picture"><div class="layui-input-inline"><input type="text" name="yzm[ads][pre][list]['+pre_ads_len+'][file]" class="layui-input" placeholder="图片链接" ></div><div class="layui-input-inline"><input type="text" name="yzm[ads][pre][list]['+pre_ads_len+'][link]" class="layui-input" placeholder="跳转链接" ></div><div class="layui-input-inline"><input type="number" name="yzm[ads][pre][list]['+pre_ads_len+'][time]" class="layui-input" placeholder="显示时间(秒)" ></div><div class="layui-input-inline w400 p10"><a href="javascript:void(0)" class="pause-remove">删除'+pre_ads_len+'</a></div></div>';
        $("#pre_list").append(tpl);
    });	
	if(pre_ads_len==0){
		$('.pre-add').click();
	}
	$('.ads-content').on('click','.pause-remove',function(){
        var datai = $(this).parent().parent().attr('data-i');
        $(this).parent().parent().remove();
    });
	$('.upload-img').hover(function(e) {
		var e = window.event || e;
		var imgsrc = $(this).val();
		if (imgsrc.trim() == "") {
			return
		}
		var left = e.clientX + document.body.scrollLeft + 20;
		var top = e.clientY + document.body.scrollTop + 20;
		$(".showpic").css({
			'left': left,
			'top': top,
			'width': "300px",
			'height': "200px",
			'display': ""
		});
		$(".showpic_img").attr("src", imgsrc)
	}, function(e) {
		$(".showpic").css("display", "none")
	})
});
</script>

</body>
</html>